# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=punter
pkgver=45.97b7bed
pkgrel=4
pkgdesc='Hunt domain names using DNSDumpster, WHOIS, Reverse WHOIS, Shodan, Crimeflare.'
groups=('blackarch' 'blackarch-recon')
arch=('any')
url='https://github.com/nethunteros/punter'
license=('custom:unknown')
depends=('python2' 'python2-argparse' 'python2-requests' 'python2-dnspython'
         'python2-beautifulsoup4' 'python2-python-whois' 'python2-ipwhois'
         'python2-configparser' 'python2-api-dnsdumpster' 'python2-ipaddr'
         'python2-future' 'python2-lxml' 'python2-shodan')
makedepends=('git')
source=("git+https://github.com/nethunteros/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.MD
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.MD LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 main.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

